<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: MACHENIKE
  Date: 2022/8/20
  Time: 15:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加</title>
    <script src = "js/jquery3.1.1.js"></script>

    <script>
        function volidForm(){
            var flag = true;
            var name  =$("#name").val();
            var author = $("#author").val();
            var publish = $("#publish").val();
            var publishdate = $("#publishdate").val();
            if (name == ""){
                flag  = false;
                alert("图书的名字不能为空！！")
                return flag;
            }
            if (author == ""){
                flag = false;
                alert("作者不能为空！！")
                return flag;
            }
            if (publish == ""){
                flag =false;
                alert("出版社不能为空！！")
                return flag;
            }
            if (publishdate == ""){
                flag = false;
                alert("出版时间不能为空！！")
                return flag;
            }
            return flag;

        }
    </script>
</head>
<body>

    <div>
        <form action="/Book/queryAdd.do" onsubmit = "return volidForm()">
            <table border = "1px" align="center" cellpadding="0px" cellspacing="0px" width="50%">
                <tr>
                    <td>书名</td>
                    <td>
                        <input name="name" id="name">
                    </td>
                </tr>
                <tr>
                    <td>作家</td>
                    <td>
                        <input name="author" id="author">
                    </td>
                </tr>
                <tr>
                    <td>出版社</td>
                    <td>
                        <input name="publish" id="publish">
                    </td>
                </tr>
                <tr>
                    <td>出版时间</td>
                    <td>
                        <input name="publishdate" id="publishdate">
                    </td>
                </tr>
                <tr>
                    <td>页数</td>
                    <td>
                        <input name="page">
                    </td>
                </tr>
                <tr>
                    <td>价格</td>
                    <td>
                        <input name="price">
                    </td>
                </tr>
                <tr>
                    <td>内容摘要</td>
                    <td>
                        <input name="content">
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="submit" value="提交">
                    </td>
                    <td>
                        <button>
                            <a href="books.jsp">返回</a>
                        </button>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</body>
</html>
